<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>로그인 처리 페이지</title>
</head>
<body>

<%
String adminID = application.getInitParameter("AdminID");
String adminPW = application.getInitParameter("AdminPW");

String id = request.getParameter("login_id");
String pw = request.getParameter("login_pw");

if (adminID.equals(id) && adminPW.equals(pw)) {
	session.setAttribute("loginId", id);
	
	ArrayList<String> list = new ArrayList<String>();
	list.add("안녕하세요");
	list.add("SERVLET");
	list.add("JSP");
	
	session.setAttribute("list", list);
	
	out.println("로그인에 성공하였습니다.<br/><br/>");
	out.println("<a href='login_form.jsp'>로그인 페이지로 이동</a>");
} else if (adminID.equals(id)) {
	out.println("<script type='text/javascript'>");
	out.print("alert('");
	out.print("패스워드가 틀렸습니다.");
	out.println("');");
	out.println("history.back();");
	out.println("</script>");
} else {
	out.println("<script type='text/javascript'>");
	out.print("alert('");
	out.print("아이디가 틀렸습니다.");
	out.println("');");
	out.println("history.back();");
	out.println("</script>");
}
%>


</body>
</html>